#include <iostream>
#include <cmath>
#include <cstdlib>
#include <string>
#include <ctime>
#include <vector>
using namespace std;


// The highest level test case delimiter
const string TEST_CASE_DELI = "@TEST_INPUT";

// The new line symbol
const string NET_LINE = "\n\r";

// The keywords
vector<string> keywords;

// The example
string example;


/**
 * Initialize the keywords.
 */
void init_keywords();


/**
 * Initialize the example.
 */
void init_example();


/**
* Initialize the global settings.
*/
void init_global()
{
	// Global random seed initialization
	//srand(time(NULL));

	// Keyword initialization
	init_keywords();

	// Example initialization
	init_example();
}


/**
 * Get a random char.
 *  - x: special chars
 *  - s: symbols
 *  - n: numbers
 *  - l: letters
 *	- a: all
 *  - (other): all
 */
char get_char(char char_type = 'a')
{
	switch (char_type)
	{
	case 'x':
		return rand() % 32;

	case 's':
		int rs;
		do { rs = rand() % 128; } while (!((32 <= rs&&rs <= 47) || (58 <= rs&&rs <= 64) || (91 <= rs&&rs <= 96) || (123 <= rs)));
		return rs;

	case 'n':
		return '0' + rand() % 10;

	case 'l':
		return rand() % 26 + ((rand() % 2 == 1) ? ('a') : ('A'));

	case 'a':
	default:
		return rand() % 128;
	}
}


/**
* Get a random string of particular length.
*  - x: special chars
*  - s: symbols
*  - n: numbers
*  - l: letters
*	- a: all
*  - (other): all
*/
string get_str(int len, char str_type = 'a')
{
	string res = "";
	while (len--) res.append(1u, get_char(str_type));
	return res;
}


/**
 * Get the test case block.
 */
string get_testcase(string inputs, string params = "")
{
	return
		TEST_CASE_DELI + ((params.length() > 0) ? (" " + params) : ("")) + NET_LINE +
		inputs + NET_LINE +
		NET_LINE;
}


/**
* Get a random keyword.
*/
string get_keyword()
{
	if (keywords.empty()) return "";
	return keywords[rand() % keywords.size()];
}


/**
* Get the example test cases.
*/
string get_example();



// ==========================================================
//                The main function logic.
// ==========================================================
void generate_test();
int main()
{
	// Redirect stdin and stdout
	//freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);

	// Global initialization
	init_global();

	// Generate the 
	generate_test();

	// Exit the program
	return 0;
}

#include "test_print_tokens.hpp";

